package com.dl.base

import android.app.Application
import com.dl.base.api.BaseNet
import com.dl.base.api.websocket.WebSocketWorkerImpl
import com.tencent.mmkv.MMKV

open class BaseApplication : Application() {
    companion object {
        val net by lazy { BaseNet() }

        fun <T> retrofitCreate(service: Class<T>): T {
            return net.retrofit.create(service)
        }

        fun webSocketCreate(): WebSocketWorkerImpl {
            return net.webSocket
        }
    }

    override fun onCreate() {
        super.onCreate()
        MMKV.initialize(this)
        AppContext.init(this)
    }
}